<?php require_once "config.php";
	  require_once "dbconfig.php";
$method;
if($_POST["method"]){
	$method = $_POST["method"];
}else{
	$method = $_GET["method"];
}
$countNum = 0;
 if($method=="cancel"){
	$userNames = $_POST['userNames'];
	$sqlQuery = "select count(*) from app_pp_user_health where user_name in ('".$userNames."')";
	$countNum = mysql_db_query($database, $sqlQuery);
	if($countNum >= 5){
		$sqlInsert = "update app_pp_user_health set status='2' where out_id='".$uid."'";
		$flag = mysql_db_query($database, $sqlInsert);
	}
	#header("Location: http://apps.xiaonei.com/dongdong/");
}

$tab = "cancel";
require_once "tab.inc.php";

?>
<div style="float:left;padding:1px;overflow-y:no;width:300px;height:220px;text-align:left;border:0px #FFE5C0 solid;clear:both">
<xn:invite-form>
  <xn:multi-friend-selector max="5"/>
  <input type="submit" class="inputsubmit" value="邀请好友来量量"/>
</xn:invite-form>
</div>
<div style="float:left;margin:10px;width:315px;height:200px;background:url(<?php echo $_ENV['imgUrl']?>/box_grey_315x150_bar.gif) no-repeat;TEXT-ALIGN:center;clear:both">
<?php 
 if($method=="cancel"){
?>
    <p/>
	<p/>
    <div style="color:#363636;font-weight:bold;margin-left:10px;line-height:27px;font-size:18px;MARGIN-RIGHT: auto;MARGIN-LEFT: auto;">
	<?php if($countNum >= 5){ echo "退出审请成功!<br/><br/><a href='".$_ENV['xiaoneiUrl']."'/index.php'>返 回</a>"; }else{
	   $leavlNum = 5 - $countNum;
	   echo "您邀请了".$countNum."个好友.还需要邀请".$leavlNum."个好友才能退出游戏"; }?></div>
<?php }else{?>
      <form action="cancelUserHealth.php" id="body_form" method="post">
	    <input type="hidden" name="method" value="cancel"/>
        <div style="color:#363636;font-weight:bold;margin-left:10px;line-height:27px;font-size:18px;">申请退出游戏</div>
        <ul >
            <li>你需要邀请五位好友来游戏，才能退出哦</li>
            <li><span style="color:#FF6600;font-size:12px;">输入邀请过的好友名称,以逗号分割</span><textarea name="userNames" cols="50" rows="3"></textarea></li>
            <li><span align="center" height="20px"><input type="submit" value="提交申请"/></span></li>
        </ul>
	</form>
<?php } ?>
</div>
<div class="clear:both"></div>

